home *** CD-ROM | disk | FTP | other *** search
/ Kids' Bible Fun Pack / Kids' CD-ROM Bible Fun Pack (1997)(Education Publishing Concepts)[Mac-PC].iso / mac / BIBLEC / XTRAS / FileFlex Xtras / -Database Designer / 00002_Script_Initialization Scripts < prev    next >
Text File  |  1995-07-22  |  18KB  |  490 lines

  1. on startMovie
  2.   global dgBlueColor
  3.   global dgYellowColor
  4.   global dgDkBlueColor
  5.   put the foreColor of member "blueModel" into dgBlueColor
  6.   put the foreColor of member "yellowModel" into dgYellowColor
  7.   put the foreColor of member "dkBlueModel" into dgDkBlueColor
  8.   initCreate
  9. end startMovie
  10.  
  11. on stopMovie
  12.   closeCreate
  13. end stopMovie
  14.  
  15. on closeWindow
  16.   put the windowList into theList
  17.   repeat with i = 1 to count(theList)
  18.     put string(getAt(theList,i)) into theItem
  19.     delete word 1 of theItem
  20.     delete char 1 of theItem
  21.     put the number of chars of theItem into theChar
  22.     delete char theChar-1 to theChar of theItem
  23.     if (theItem contains "Database Designer") or (theItem contains "FFDESIG") then
  24.       forget window theItem
  25.     end if
  26.   end repeat
  27.   tell the stage to puppetPalette 0
  28.   tell the stage to updateStage
  29. end closeWindow
  30.  
  31. on initCreate 
  32.   global topPointsToLine, baseSprite, spriteArray
  33.   global dgBlueColor, dgYellowColor
  34.   set baseSprite to 28
  35.   --  preload
  36.   puppetSprite 23,TRUE -- trash
  37.   set the loc of sprite 23 to point(228, 356)
  38.   puppetSprite 45,TRUE -- draggin' panel
  39.   puppetSprite 46,TRUE
  40.   puppetSprite 47,TRUE
  41.   locHide 45
  42.   locHide 46
  43.   locHide 47
  44.   hideDefineField
  45.   put EMPTY into field "visNameList"
  46.   put EMPTY into field "visTypeList"
  47.   put EMPTY into field "visWidthList"
  48.   put EMPTY into field "visDecimalsList"
  49.   put EMPTY into field "masterNameList"
  50.   put EMPTY into field "masterTypeList"
  51.   put EMPTY into field "masterWidthList"
  52.   put EMPTY into field "masterDecimalsList"
  53.   set the textHeight of member "visNameList" to 16
  54.   set the textHeight of member "visTypeList" to 16
  55.   set the textHeight of member "visWidthList" to 16
  56.   set the textHeight of member "visDecimalsList" to 16
  57.   set the textSize of member "visNameList" to 12
  58.   set the textSize of member "visTypeList" to 12
  59.   set the textSize of member "visWidthList" to 12
  60.   set the textSize of member "visDecimalsList" to 12
  61.   set the foreColor of member "visNameList" to dgYellowColor
  62.   set the foreColor of member "visTypeList" to dgYellowColor
  63.   set the foreColor of member "visWidthList" to dgYellowColor
  64.   set the foreColor of member "visDecimalsList" to dgYellowColor
  65.   put 1 into topPointsToLine
  66.   
  67.   set the loc of sprite (baseSprite) to point(-29, -9)
  68.   set the loc of sprite (baseSprite+1) to point(291, 186)
  69.   set the loc of sprite (baseSprite+2) to point(274, 262)
  70.   set the loc of sprite (baseSprite+3) to point(437, 80)
  71.   set the loc of sprite (baseSprite+4) to point(369, 79)
  72.   set the loc of sprite (baseSprite+5) to point(257, 245)
  73.   set the loc of sprite (baseSprite+6) to point(413, 188)
  74.   set the loc of sprite (baseSprite+7) to point(334, 161)
  75.   set the loc of sprite (baseSprite+8) to point(369,151)
  76.   set the loc of sprite (baseSprite+9) to point(374, 195)
  77.   set the loc of sprite (baseSprite+10) to point(286, 163)
  78.   set the loc of sprite (baseSprite+11) to point(288, 214)
  79.   set the loc of sprite (baseSprite+12) to point(269, 107)
  80.   repeat with i = baseSprite to (baseSprite+12)
  81.     locHide i
  82.   end repeat
  83. end initCreate
  84.  
  85. on closeCreate
  86.   locHide 45
  87.   locHide 46
  88.   locHide 47
  89.   puppetSprite 45,FALSE -- draggin' panel
  90.   puppetSprite 46,FALSE -- draggin' panel
  91.   puppetSprite 47,FALSE -- draggin' panel
  92.   puppetSprite 23,FALSE -- trash
  93.   put EMPTY into field "visNameList"
  94.   put EMPTY into field "visTypeList"
  95.   put EMPTY into field "visWidthList"
  96.   put EMPTY into field "visDecimalsList"
  97.   put EMPTY into field "masterNameList"
  98.   put EMPTY into field "masterTypeList"
  99.   put EMPTY into field "masterWidthList"
  100.   put EMPTY into field "masterDecimalsList"
  101. end closeCreate
  102.  
  103. on showDefineField panel
  104.   global baseSprite, fieldSpec, keyEditOK
  105.   locHide 45
  106.   locHide 46
  107.   locHide 47
  108.   updateStage
  109.   put 28 into baseSprite -- allows me to move the sprite down
  110.   repeat with i = (baseSprite) to (baseSprite+12)
  111.     puppetSprite i,TRUE
  112.   end repeat
  113.   updateStage
  114.   -- show the dialog box
  115.   locShow baseSprite
  116.   locShow baseSprite+1
  117.   -- build the fieldSpec from the panel
  118.   put word 1 of panel into theType
  119.   case (theType) of
  120.     "text":
  121.       put ",C,25" into fieldSpec
  122.     "numeric":
  123.       put ",N,3,2" into fieldSpec
  124.     "boolean":
  125.       put ",L" into fieldSpec
  126.     "memo":
  127.       put ",M" into fieldSpec
  128.     "date":
  129.       put ",D" into fieldSpec
  130.   end case
  131.   setDefineField
  132.   put TRUE into keyEditOK
  133. end showDefineField
  134.  
  135. on setDefineField 
  136.   global baseSprite, fieldSpec, dgDkBlueColor
  137.   set the itemDelimiter to ","
  138.   -- parse the standard field specification
  139.   put item 1 of fieldSpec into theName
  140.   if theName = EMPTY then
  141.     put "_" into field "FieldEntry"
  142.   else
  143.     put theName into field "FieldEntry"
  144.   end if
  145.   put item 2 of fieldSpec into theType
  146.   if theType = "C" or theType = "N" then
  147.     put item 3 of fieldSpec into theWidth
  148.   end if
  149.   if theType = "N" then put item 4 of fieldSpec into theDecimals
  150.   -- set up the location of the type selection rect
  151.   case theType of
  152.     "C":
  153.       set the loc of sprite (baseSprite+2) to point(274, 262)
  154.     "N":  
  155.       set the loc of sprite (baseSprite+2) to point(312, 262)
  156.     "L":
  157.       set the loc of sprite (baseSprite+2) to point(350, 262)
  158.     "D":
  159.       set the loc of sprite (baseSprite+2) to point(388, 262)
  160.     "M":
  161.       set the loc of sprite (baseSprite+2) to point(426, 262)
  162.     otherwise
  163.       set the loc of sprite (baseSprite+2) to point(274, 262) -- text
  164.   end case
  165.   -- show the OK and Cancel buttons
  166.   locShow baseSprite+3 -- OK
  167.   locShow baseSprite+4 -- Cancel
  168.   -- enable the button selection bar
  169.   locShow baseSprite+5
  170.   --updateStage
  171.   -- initialize the counter fields
  172.   set the text of member "widthData" to ""
  173.   set the text of member "decimalsData" to ""
  174.   locHide baseSprite+8
  175.   locHide baseSprite+9
  176.   -- initialize the block fields
  177.   locShow baseSprite+10
  178.   locShow baseSprite+11
  179.   set the textStyle of member "decimalsData" to "bold"
  180.   set the textFont of member "decimalsData" to "helvetica"
  181.   set the textSize of member "decimalsData" to 9
  182.   set the textStyle of member "widthData" to "bold"
  183.   set the textFont of member "widthData" to "helvetica"
  184.   set the textSize of member "widthData" to 9
  185.   set the textAlign of member "widthData" to "right"
  186.   set the textAlign of member "decimalsData" to "right"
  187.   set the foreColor of member "decimalsData" to dgDkBlueColor
  188.   set the foreColor of member "widthData" to dgDkBlueColor
  189.   
  190.   if theType = "C" then
  191.     locShow baseSprite+8
  192.     -- show the drag bar for Field Width
  193.     locShow baseSprite+6
  194.     fieldWidthValue theWidth, 255  -- 255 for char field
  195.     -- update the blocker rects
  196.     locHide baseSprite+10
  197.   end if
  198.   if theType = "N"then
  199.     locShow baseSprite+8
  200.     locShow baseSprite+9
  201.     -- show the drag bar for Field Width
  202.     locShow baseSprite+6
  203.     fieldWidthValue theWidth, 10 -- 10 for numeric field
  204.     -- show the drag bar for Decimals Width
  205.     locShow baseSprite+7
  206.     decimalsWidthValue theDecimals, 8 -- 8 for numeric field
  207.     -- update the blocker rects
  208.     locHide baseSprite+10
  209.     locHide baseSprite+11
  210.   end if
  211.   locShow baseSprite+12
  212.   updateStage
  213. end setDefineField
  214.  
  215. on hideDefineField
  216.   global baseSprite, spriteArray, keyEditOK
  217.   put FALSE into keyEditOK
  218.   put 28 into baseSprite -- allows me to move the sprite down
  219.   --put EMPTY into spriteArray
  220.   repeat with i = (baseSprite) to (baseSprite+12)
  221.     locHide i
  222.   end repeat
  223.   updateStage
  224.   repeat with i = baseSprite to (baseSprite+12)
  225.     puppetSprite i,FALSE
  226.   end repeat
  227. end hideDefineField
  228.  
  229. on fieldWidthValue width, widthMax
  230.   global fieldSpec
  231.   global dgDkBlueColor
  232.   -- point(xxx,173)
  233.   -- max is point(439,173)
  234.   -- min is point(136,173)
  235.   global baseSprite
  236.   locHide baseSprite+6
  237.   put 173 into dragY
  238.   put 136 into dragMin
  239.   put 439 into dragMax
  240.   put dragMax - dragMin into zoneSize
  241.   put float(zoneSize)/float(widthMax) into perItemWidth -- max field width
  242.   if width<1 then put 1 into width
  243.   put float(width) * float(perItemWidth) into pixelsOver
  244.   put dragMin + integer(pixelsOver) into theX
  245.   set the loc of sprite (baseSprite+6) to point(theX,dragY)
  246.   set the text of member "widthData" to string(integer(width))
  247.   put string(integer(width)) into item 3 of fieldSpec
  248.   set the textStyle of member "widthData" to "bold"
  249.   set the textFont of member "widthData" to "helvetica"
  250.   set the textSize of member "widthData" to 9  
  251.   set the textAlign of member "widthData" to "right"
  252.   set the foreColor of member "widthData" to dgDkBlueColor
  253. end fieldWidthValue
  254.  
  255. on fieldWidthPixel Xcoord, widthMax
  256.   -- point(xxx,173)
  257.   -- max is point(439,173)
  258.   -- min is point(136,173)
  259.   global baseSprite, fieldSpec, dgDkBlueColor
  260.   put 173 into dragY
  261.   put 136 into dragMin
  262.   put 439 into dragMax
  263.   put dragMax - dragMin into zoneSize
  264.   put float(zoneSize)/float(widthMax) into perItemWidth -- max field width
  265.   if Xcoord < dragMin then put dragMin into Xcoord
  266.   if Xcoord > dragMax then put dragMax into Xcoord
  267.   put Xcoord - dragMin into Xoffset
  268.   put integer(float(Xoffset)/float(perItemWidth)) into width
  269.   if width<1 then put 1 into width
  270.   put float(width) * float(perItemWidth) into pixelsOver
  271.   put dragMin + integer(pixelsOver) into theX
  272.   set the loc of sprite (baseSprite+6) to point(theX,dragY)
  273.   set the text of member "widthData" to string(integer(width))
  274.   put string(integer(width)) into item 3 of fieldSpec
  275.   set the textStyle of member "widthData" to "bold"
  276.   set the textFont of member "widthData" to "helvetica"
  277.   set the textSize of member "widthData" to 9  
  278.   set the textAlign of member "widthData" to "right"
  279.   set the foreColor of member "widthData" to dgDkBlueColor
  280.   updateStage
  281. end fieldWidthPixel
  282.  
  283. -- admittedly fieldWidth... and decimalsWidth.. handlers are
  284. -- virtually identical, but keeping them as separate handlers
  285. -- makes tweaking and pixel pushing way easier
  286. on decimalsWidthValue width, widthMax
  287.   -- point(xxx,217)
  288.   -- max is point(439,217)
  289.   -- min is point(241,217)
  290.   global baseSprite, dgDkBlueColor
  291.   locHide baseSprite+7
  292.   put 217 into dragY
  293.   put 241 into dragMin
  294.   put 439 into dragMax
  295.   put dragMax - dragMin into zoneSize
  296.   put float(zoneSize)/float(widthMax) into perItemWidth -- max field width
  297.   put float(width) * float(perItemWidth) into pixelsOver
  298.   put dragMin + integer(pixelsOver) into theX
  299.   set the loc of sprite (baseSprite+7) to point(theX,dragY)
  300.   set the text of member "decimalsData" to string(integer(width))
  301.   put string(integer(width)) into item 4 of fieldSpec
  302.   set the textStyle of member "decimalsData" to "bold"
  303.   set the textFont of member "decimalsData" to "helvetica"
  304.   set the textAlign of member "decimalsData" to "right"
  305.   set the textSize of member "decimalsData" to 9
  306.   set the foreColor of member "decimalsData" to dgDkBlueColor
  307. end fieldWidthValue
  308.  
  309. on decimalsWidthPixel Xcoord, widthMax
  310.   -- point(xxx,217)
  311.   -- max is point(439,217)
  312.   -- min is point(241,217)
  313.   global baseSprite, fieldSpec, dgDkBlueColor
  314.   put 217 into dragY
  315.   put 241 into dragMin
  316.   put 439 into dragMax
  317.   put dragMax - dragMin into zoneSize
  318.   put float(zoneSize)/float(widthMax) into perItemWidth -- max field width
  319.   if Xcoord < dragMin then put dragMin into Xcoord
  320.   if Xcoord > dragMax then put dragMax into Xcoord
  321.   put Xcoord - dragMin into Xoffset
  322.   put integer(float(Xoffset)/float(perItemWidth)) into width
  323.   put float(width) * float(perItemWidth) into pixelsOver
  324.   put dragMin + integer(pixelsOver) into theX
  325.   set the loc of sprite (baseSprite+7) to point(theX,dragY)
  326.   set the text of member "decimalsData" to string(integer(width))
  327.   put string(integer(width)) into item 4 of fieldSpec
  328.   set the textStyle of member "decimalsData" to "bold"
  329.   set the textFont of member "decimalsData" to "helvetica"
  330.   set the textSize of member "decimalsData" to 9
  331.   set the textAlign of member "decimalsData" to "right"
  332.   set the foreColor of member "decimalsData" to dgDkBlueColor
  333.   updateStage
  334. end fieldWidthPixel
  335.  
  336.  
  337. on locHide theSprite
  338.   global spriteArray
  339.   set the itemDelimiter to "|"
  340.   put the loc of sprite theSprite into thePoint
  341.   if thePoint <> point(-900,-900) then
  342.     put string(thePoint) into item theSprite of spriteArray
  343.     set the loc of sprite theSprite to point(-900,-900)  
  344.   end if
  345.   set the itemDelimiter to ","
  346. end locHide
  347.  
  348. on locShow theSprite
  349.   global spriteArray
  350.   set the itemDelimiter to "|"
  351.   put item theSprite of spriteArray into theStringPoint
  352.   set the loc of sprite theSprite to value(theStringPoint)
  353.   set the itemDelimiter to ","
  354. end locShow
  355.  
  356. on initIndex 
  357.   global topPointsToLine, baseSprite, spriteArray, dgYellowColor, dgDkBlueColor
  358.   puppetSprite 23,TRUE -- trash
  359.   -- set the loc of sprite 23 to point(358,356) -- under the line, under index expr
  360.   set the loc of sprite 23 to point(358,300) -- directly under index expr
  361.   updateStage
  362.   puppetSprite 45,TRUE -- draggin' panel
  363.   puppetSprite 46,TRUE
  364.   puppetSprite 47,TRUE
  365.   locHide 45
  366.   locHide 46
  367.   locHide 47
  368.   put EMPTY into field "visNameList"
  369.   put EMPTY into field "visTypeList"
  370.   put EMPTY into field "visWidthList"
  371.   put EMPTY into field "visDecimalsList"
  372.   put EMPTY into field "masterNameList"
  373.   put EMPTY into field "masterTypeList"
  374.   put EMPTY into field "masterWidthList"
  375.   put EMPTY into field "masterDecimalsList"
  376.   put EMPTY into field "indexExpr"
  377.   set the textHeight of member "visNameList" to 16
  378.   set the textHeight of member "visTypeList" to 16
  379.   set the textHeight of member "visWidthList" to 16
  380.   set the textHeight of member "visDecimalsList" to 16
  381.   set the textSize of member "visNameList" to 12
  382.   set the textSize of member "visTypeList" to 12
  383.   set the textSize of member "visWidthList" to 12
  384.   set the textSize of member "visDecimalsList" to 12
  385.   set the foreColor of member "visNameList" to dgYellowColor
  386.   set the foreColor of member "visTypeList" to dgYellowColor
  387.   set the foreColor of member "visWidthList" to dgYellowColor
  388.   set the foreColor of member "visDecimalsList" to dgYellowColor
  389.   put 1 into topPointsToLine
  390.   
  391.   -- for alert dialogs
  392.   set the loc of sprite (baseSprite) to point(-29, -9)
  393.   set the loc of sprite (baseSprite+1) to point(291, 186)
  394.   set the loc of sprite (baseSprite+3) to point(437, 80)
  395.   locHide baseSprite
  396.   locHide baseSprite+1
  397.   locHide baseSprite+3
  398.   
  399.   -- index area highlight
  400.   set the loc of sprite 14 to point(343, 192)
  401.   locHide 14
  402.   
  403.   put "This area is used to construct an index expression:" into field "indexMessage"
  404.   set the foreColor of member "indexMessage" to dgDkBlueColor
  405.   set the textSize of member "indexMessage" to 9
  406.   set the textStyle of member "indexMessage" to "bold"
  407.   set the textFont of member "indexMessage" to "Helvetica"
  408.   updateStage
  409. end initIndex
  410.  
  411. on closeIndex
  412.   locHide 45
  413.   locHide 46
  414.   locHide 47
  415.   puppetSprite 45,FALSE -- draggin' panel
  416.   puppetSprite 46,FALSE -- draggin' panel
  417.   puppetSprite 47,FALSE -- draggin' panel
  418.   puppetSprite 23,FALSE -- trash
  419.   put EMPTY into field "visNameList"
  420.   put EMPTY into field "visTypeList"
  421.   put EMPTY into field "visWidthList"
  422.   put EMPTY into field "visDecimalsList"
  423.   put EMPTY into field "masterNameList"
  424.   put EMPTY into field "masterTypeList"
  425.   put EMPTY into field "masterWidthList"
  426.   put EMPTY into field "masterDecimalsList"
  427.   put "This area used to construct an index expression:" into field "indexMessage"
  428. end closeIndex
  429.  
  430. on moveIt theSprite, theLoc
  431.   set the loc of sprite theSprite to theLoc
  432.   updateStage
  433. end moveIt
  434.  
  435. on initBrowse
  436.   global topPointsToLine, baseSprite, spriteArray, dgYellowColor, dgDkBlueColor
  437.   puppetSprite 23,TRUE -- trash
  438.   set the loc of sprite 23 to point(-900,-900) -- directly under index expr
  439.   updateStage
  440.   puppetSprite 45,TRUE -- draggin' panel
  441.   puppetSprite 46,TRUE
  442.   puppetSprite 47,TRUE
  443.   locHide 45
  444.   locHide 46
  445.   locHide 47
  446.   put EMPTY into field "visNameList"
  447.   put EMPTY into field "visContentList"
  448.   put EMPTY into field "masterNameList"
  449.   put EMPTY into field "masterContentList"
  450.   set the textHeight of member "visNameList" to 16
  451.   set the textHeight of member "visContentList" to 16
  452.   set the textSize of member "visNameList" to 12
  453.   set the textSize of member "visContentList" to 12
  454.   set the foreColor of member "visNameList" to dgYellowColor
  455.   set the foreColor of member "visContentList" to dgYellowColor
  456.   put 1 into topPointsToLine
  457.   
  458.   -- for alert dialogs
  459.   set the loc of sprite (baseSprite) to point(-29, -9)
  460.   set the loc of sprite (baseSprite+1) to point(291, 186)
  461.   set the loc of sprite (baseSprite+3) to point(437, 80)
  462.   locHide baseSprite
  463.   locHide baseSprite+1
  464.   locHide baseSprite+3
  465.   
  466.   
  467.   put "" into field "browseMessage"
  468.   set the foreColor of member "browseMessage" to dgDkBlueColor
  469.   set the textSize of member "browseMessage" to 9
  470.   set the textStyle of member "browseMessage" to "bold"
  471.   set the textFont of member "browseMessage" to "Helvetica"
  472.   updateStage
  473. end initBrowse
  474.  
  475. on closeBrowse
  476.   global dgDkBlueColor
  477.   puppetSprite 23, FALSE
  478.   puppetSprite 23,FALSE -- trash
  479.   put EMPTY into field "visNameList"
  480.   put EMPTY into field "visContentList"
  481.   put EMPTY into field "masterNameList"
  482.   put EMPTY into field "masterContentList"
  483.   
  484.   put "" into field "browseMessage"
  485.   set the foreColor of member "browseMessage" to dgDkBlueColor
  486.   set the textSize of member "browseMessage" to 9
  487.   set the textStyle of member "browseMessage" to "bold"
  488.   set the textFont of member "browseMessage" to "Helvetica"
  489. end closeBrowse
  490.